import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import vueJsx from '@vitejs/plugin-vue-jsx'
// import { viteMockServe } from "vite-plugin-mock";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx({
      // options are passed on to @vue/babel-plugin-jsx
    }),
    // viteMockServe({
    //   supportTs: false,
    //   mockPath: './src/mock',
    //   localEnabled: true,//是否开启本地的mock功能
    //   prodEnabled: true,// 生产打包开关
    // })
  ],
  server: {
    open: false,
    port: 8080,
    https: false,
    host: '0.0.0.0',
    origin: "http://127.0.0.1:8080/",
    // proxy: {
    //   '/api': {
    //     target: target,
    //     changeOrigin: true,
    //     rewrite: (pathStr) => pathStr.replace('/api', '')
    //   }
    // }
  },
  resolve: {
    //别名
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        // 添加公共样式
        additionalData: `
          @import "./src/assets/styles/variable.scss"; 
          @import "./src/assets/styles/common.scss";
        `
      }
    }
  }
})
